package com.cmd.driver;

import com.alibaba.fastjson.JSONObject;
import com.player.DriverUser;
import com.player.User;
import com.qy.bean.DriverInfo;
import com.qy.util.StaticData;
import com.util.AbstractCommand;
import com.util.PBMessage;

public class BankBindCMD  extends AbstractCommand{

	@Override
	public void execute(User user, PBMessage packet) throws Exception {
		JSONObject reJs = new JSONObject();
		reJs.put(StaticData.reKey.cmd.getKey(),packet.getCode());
		JSONObject param = packet.getMessage();
		if(!param.containsKey("bankName")||!param.containsKey("bankCard")){
			reJs.put(StaticData.reKey.code.getKey(), StaticData.codeType.param_error.getType());
			user.sendPacket(reJs);
			return;
		}
		DriverInfo dInfo = ((DriverUser)user).getDriverInfo();
		//银行名称
		String bankName = param.getString("bankName");
		//银行卡号
		String bankCar = param.getString("bankCar");
		
		dInfo.setBankName(bankName);
		dInfo.setBankCar(bankCar);
		
		reJs.put(StaticData.reKey.code.getKey(), StaticData.codeType.ok.getType());
		reJs.put(StaticData.reKey.cmd.getKey(),packet.getCode());
		user.sendPacket(reJs);
		return;
	}

}
